import React from 'react';
import Icon from "../icon/Icon"
import { History } from "history";



import { MenuList } from "./MenuList"


interface MenuspProp extends MenuList {

    history?: History;

}



class Menu extends React.Component<MenuspProp, any> {

    constructor(props: MenuspProp) {
        super(props);
        //局部的 state
        this.state = {

        };
    }


    chlickPage = (pathname: string) => {
        console.log("123", "pathname");
        let history1 = this.props.history as History;
        history1.push(pathname)
    }


    render() {
        return (
            <div className='bigMenu' onClick={e => this.chlickPage(this.props.path as string)}>
                <div className='smallMenu'>
                    <Icon name={this.props.iconName} fill={this.props.fill ?? "#98BAFF"} />
                </div>
                <span className='menuTitle'>{this.props.title}</span>
            </div>
        );
    }
}


export default Menu;